﻿using FastIOC.Application;
using FastIOC.Enum;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastCore.Test.IOC
{
    [TestClass]
    public class ComponentOperate
    {
        [TestMethod]
        public void ScopeCOmpare()
        {
            ContainerBuilder Container = ContainerBuilder.GetInstance();
            Container.RegisterType<SingleComponent>();
            Container.RegisterType<RequestComponent>();
            Container.Build(CotainerEnum.BuidlModel.OverWrite);
            SingleComponent single1 = Container.Resolve<SingleComponent>();
            SingleComponent single2 = Container.Resolve<SingleComponent>();
            RequestComponent request1 = Container.Resolve<RequestComponent>();
            RequestComponent request2 = Container.Resolve<RequestComponent>();
            Assert.AreEqual(single1.Guid == single2.Guid, true);
            Assert.AreEqual(request1.Guid == request2.Guid, false);
        }
    }
}
